const express = require('express')
var app = express()
const fs = require("fs")

app.get('/:id', function (req, res) {
   // 首先我们读取已存在的用户
   fs.readFile( __dirname + "/" + "users.json", 'utf8', function (err, data) {
       data = JSON.parse( data )
       var user = data["user" + req.params.id] 
       console.log( user )
       res.end( JSON.stringify(user))
       console.log(":id successfully!")  
   })
})

app.listen(8081, function () {
  console.log("http://localhost:8081/:id")
})